<template>
    <div class="login">
<el-form ref="form" :model="form" label-width="80px">
  <el-form-item label="名字">
    <el-input v-model="form.name"></el-input>
  </el-form-item>
  <el-form-item label="密码">
    <el-input v-model="form.password" show-password></el-input>
  </el-form-item>
 

  <el-form-item>
    <el-button type="primary" @click="onSubmit">立即登录</el-button>
    <el-button>取消</el-button>
  </el-form-item>
</el-form>

    </div>
</template>



<script>
export default {
    name:"Login",
    data(){
        return{
            form:{
                name:"",
                password:""
            }
        }
    },
    methods:{
        onSubmit(){
            console.log(this.form)

            this.$http.get("http://192.168.80.119:8081/login",{params: this.form})

            .then(respons=>{
                 this.$message({
                  message: '登录成功',
                type: 'success'
        });
        localStorage.setItem("isLogin","islogin")
            })
            .catch(error=>{
              alert(error)
            })
        }
    }
}
</script>